package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName("t_customer_blacklist")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.CustomerBlacklistMapper")
public class CustomerBlacklistDO extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 机构主键id
     */
    @TableField(value = "org_id")
    private Long orgId;

    /**
     * 交易中心主键id
     */
    @TableField(value = "center_id")
    private Long centerId;

    /**
     * 投保客户名称
     */
    @TableField(value = "customer_name")
    private String customerName;

    /**
     * 投保客户统一社会信用代码
     */
    @TableField(value = "customer_credit_code")
    private String customerCreditCode;

    /**
     * 投保客户联系电话:订单信息中自动填充
     */
    @TableField(value = "customer_telphone")
    private String customerTelphone;

    /**
     * 投保客户联系地址
     */
    @TableField(value = "customer_address")
    private String customerAddress;

    /**
     * 投保客户法人姓名
     */
    @TableField(value = "legal_person_name")
    private String legalPersonName;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 创建用户
     */
    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    /**
     * 更新用户
     */
    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 备注说明
     */
    @TableField(value = "remark")
    private String remark;

    public CustomerBlacklistVo buildVo() {
        return new CustomerBlacklistVo(id, orgId, centerId, customerName, customerCreditCode, customerTelphone, customerAddress, legalPersonName, gmtCreate, gmtModified, userCreate, userModified, remark);
    }

    public static CustomerBlacklistDO of(CustomerBlacklistVo vo) {
        return new CustomerBlacklistDO(vo.getId(), vo.getOrgId(), vo.getCenterId(), vo.getCustomerName(), vo.getCustomerCreditCode(), vo.getCustomerTelphone(), vo.getCustomerAddress(), vo.getLegalPersonName(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getRemark());
    }
}
